package com.bjsxt;

import com.bjsxt.rpc.BjsxtRpcFactory;
import com.bjsxt.service.UserService;
import org.apache.zookeeper.KeeperException;

import java.io.IOException;
import java.rmi.NotBoundException;

public class TestRpcClient {
    public static void main(String[] args) throws InterruptedException, NotBoundException, KeeperException, IOException {
        //通过自定义框架，连接zk，获取接口发动态代理对象。
        UserService userService=BjsxtRpcFactory.getServiceProxy(UserService.class);
        System.out.println(userService.getClass().getName());
        String result = userService.getUser("管理员");
        System.out.println("远程服务返回查询结果："+result);
    }
}
